﻿using System.IO;
using System.Reflection;
using NLog;
using NLog.Config;

namespace NerdWare.Crm2011VsTools.CrmScriptInjector
{
    public static class NTrace
    {
        public static readonly Logger Default = LogManager.GetLogger(typeof(NTrace).Namespace);

        static NTrace()
        {
            LoggingConfiguration loggingConfiguration;

            string nlogConfigFile = Path.Combine(Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName, "NLog.config");
            loggingConfiguration = new XmlLoggingConfiguration(nlogConfigFile);
            LogManager.Configuration = loggingConfiguration;

            Default.Info("Assembly {0} v{1}", Assembly.GetExecutingAssembly().GetName().Name, Assembly.GetExecutingAssembly().GetName().Version);
        }
    }
}
